<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>穿梭框组件</title>
  <link rel="stylesheet" href="../layui/css/layui.css">
  <script src="layui.js"></script>
</head>
<body>
  <div id="test1"></div>
 
  <script>
  layui.use('transfer', function(){
    var transfer = layui.transfer;
   
    //渲染
    transfer.render({
      elem: '#test1'  //绑定元素
      ,data: [
        {"value": "1", "title": "李白", "disabled": "", "checked": ""}
        ,{"value": "2", "title": "杜甫", "disabled": "", "checked": ""}
        ,{"value": "3", "title": "贤心", "disabled": "", "checked": ""}
      ]
      ,id: 'demo1' //定义索引
    });


    var arr = new Array();

//------------------------
$.post('http://stuapi.ysd3g.com/api/GetRolesByUserIdLayUI', {

  uId: '37da0768-4100-4ff3-b9d7-0cc58aae2a7c',
  token: '9e129b92-124f-46c9-a1f6-369f2ea84817'

}, function(e) {

  for(var i = 0; i < e.data.length; i++) {

    arr.push(e.data[i].Id); //向数组添加元素

  }

  //layer.msg(arr)

}, 'json')



  });
  </script>
</body>
</html>